class Log {
  static DATE_MILL_PATTERN = "yyyy-MM-dd hh:mm:ss.SSS";

  static log(log: any): void;
  static log(tag: any, log: any): void;
  
  static log(arg1: any, arg2?: any): void {
      if (arg2 !== undefined) {
        console.log(arg1, `${Log.longToDate(new Date().getTime(), Log.DATE_MILL_PATTERN)} --> ${arg2}`);
      } else {
        console.log(`${Log.longToDate(new Date().getTime(), Log.DATE_MILL_PATTERN)} --> ${arg1}`);
      }
    }
    static warn(log: any): void;
    static warn(tag: any, log: any): void;

    static warn(arg1: any, arg2?: any): void {
      if (arg2 !== undefined) {
        console.warn(arg1, `${Log.longToDate(new Date().getTime(), Log.DATE_MILL_PATTERN)} --> ${arg2}`);
      } else {
        console.warn(`${Log.longToDate(new Date().getTime(), Log.DATE_MILL_PATTERN)} --> ${arg1}`);
      }
    }


  static longToDate(milSecond: number, pattern: string): string {
    const date = new Date(milSecond);

    const formattedDate = pattern
      .replace('yyyy', String(date.getFullYear()))
      .replace('MM', String(date.getMonth() + 1).padStart(2, '0'))
      .replace('dd', String(date.getDate()).padStart(2, '0'))
      .replace('hh', String(date.getHours()).padStart(2, '0'))
      .replace('mm', String(date.getMinutes()).padStart(2, '0'))
      .replace('ss', String(date.getSeconds()).padStart(2, '0'))
      .replace('SSS', String(date.getMilliseconds()).padStart(3, '0'));

    return formattedDate;
  }
}
export default Log

// Example usage
